<template>
	<view class="myOcializeInformation u-skeleton">
		<u-navbar title="社交信息" :background="{
			'backgroundColor':'#fff'
		}" :borderBottom="false" class="u-skeleton-rect"></u-navbar>
		<view class="title u-skeleton-rect">
			<u-icon name='qq-circle-fill' size='36' color='#2d8cf0'></u-icon>
			<view class="txt">QQ账号</view>
		</view>
		<view class="input-box u-skeleton-rect">
			<input type="text" v-model="qq" placeholder="请输入qq号">
		</view>
		<view class="title u-skeleton-rect">
			<u-icon name='weixin-circle-fill' size='36' color='#42b983'></u-icon>
			<view class="txt">微信号</view>
		</view>
		<view class="input-box u-skeleton-rect">
			<input type="text" v-model="weixin" placeholder="请输入微信号">
		</view>
		<u-button class="btn-primary u-skeleton-rect" @click="btn" ripple-bg-color="rgba(0,0,0,.4)"
			:ripple="true">保存</u-button>
		<u-skeleton :loading="loding" :animation="true" bgColor="#FFF"></u-skeleton>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				loding: true, //初始化骨架屏展示
				qq: '', //qq号
				weixin: '' //微信号
			}
		},
		onShow() {
			this.getinfo();
			
		},
		methods: {
			//保存编辑的社交数据
			btn(){
				this.$http.asyncSendrequest({
					url: '/profile/socializeInfo',
					data: {
						qq_no:this.qq,
						wechat_no:this.weixin
						
					},
					success: res => {
						this.$util.taost({
							title:res.msg
						})
					}
				})
			},
			//获取用户自己的信息
			getinfo() {
				this.$http.asyncSendrequest({
					url: '/profile/userInfo',
					success: res => {
						if(res.code == '0') {
							this.loding = false;
							this.qq = res.data.qq_no;
							this.weixin = res.data.wechat_no;
						} else {
							this.$util.taost({
								title:res.msg
							})
						}
					}
				})
			}

		}
	}
</script>

<style lang="scss" scoped>
	.myOcializeInformation {
		min-height: 100vh;
		background: #fff;

		.title {
			margin: 60rpx 30rpx 0;
			font-size: 26rpx;
			font-weight: bold;
			display: flex;
			align-items: center;

			.txt {
				margin-left: 20rpx;
			}
		}

		.input-box {
			height: 80rpx;
			display: flex;
			align-items: center;
			padding: 30rpx;
			margin: 30rpx;
			background: rgba(0, 0, 0, .05);
			border-radius: 8rpx;

			input {
				height: 90%;
				width: 100%;
				font-size: 26rpx;
			}
		}
	}

	.btn-primary {
		height: 96rpx;
		background: #292929;
		border-radius: 10rpx;
		text-align: center;
		line-height: 96rpx;
		font-size: 26rpx;
		font-family: PingFang SC;
		color: #FFFFFF;
		margin-top: 116rpx;
		position: fixed;
		bottom: 20rpx;
		left: 30rpx;
		width: calc(100% - 60rpx);
	}
	
</style>